﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Core.EntityClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zosnn.Models;
using Zosnn.Models.Mapping;

namespace Zosnn.DAL
{
    public class ZosnnDbContext : DbContext
    {
        static ZosnnDbContext()
        {
            Database.SetInitializer<ZosnnDbContext>(null);
        }

        public ZosnnDbContext()
            : base("Name=ZosnnContext")
        {
        }

        public DbSet<Collect> Collects { get; set; }
        public DbSet<Order> Orders { get; set; }
        public DbSet<Order_Info> Order_Info { get; set; }
        public DbSet<Product> Products { get; set; }
        public DbSet<Product_Info> Product_Info { get; set; }
        public DbSet<Product_Type> Product_Type { get; set; }
        public DbSet<Seller> Sellers { get; set; }
        public DbSet<Seller_Area> Seller_Area { get; set; }
        public DbSet<User> Users { get; set; }
        public DbSet<User_Info> User_Info { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new CollectMap());
            modelBuilder.Configurations.Add(new OrderMap());
            modelBuilder.Configurations.Add(new Order_InfoMap());
            modelBuilder.Configurations.Add(new ProductMap());
            modelBuilder.Configurations.Add(new Product_InfoMap());
            modelBuilder.Configurations.Add(new Product_TypeMap());
            modelBuilder.Configurations.Add(new SellerMap());
            modelBuilder.Configurations.Add(new Seller_AreaMap());
            modelBuilder.Configurations.Add(new UserMap());
            modelBuilder.Configurations.Add(new User_InfoMap());
        }

    }
}